//
//  ImageDisplayView.m
//  ChatDemo-UI2.0
//
//  Created by li.guibin on 16/1/8.
//  Copyright © 2016年 li.guibin. All rights reserved.
//

#import "ImageDisplayView.h"
@interface ImageDisplayView()
{
    CGRect viewFrame;
}
@end
@implementation ImageDisplayView
- (instancetype)initWithFrame:(CGRect)frame displayImageWith:(NSString *)imageName
{
    self = [super initWithFrame:frame];
    if (self) {
        viewFrame = frame;
        self.backgroundColor = [UIColor clearColor];
        if (imageName.length != 0) {
            //NSString * picURL = [NSString stringWithFormat:@"%@%@",REQUESTIMAGEURL,imageName];
            //UIImage * image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:picURL]]];
            //[self setImage:image];
            if (![imageName hasPrefix:@"http"]) {
                imageName = [NSString stringWithFormat:@"%@%@",REQUESTIMAGEURL,imageName];
            }
            [self sd_setImageWithURL:[NSURL URLWithString:imageName]];
        }
    }
    return self;
}
- (void)setCornerRadius{
    self.layer.cornerRadius = viewFrame.size.height/2;
    self.clipsToBounds = YES;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
